#ifndef FFMPEGWRAPPER_H
#define FFMPEGWRAPPER_H

#include <QObject>
#include <QSize>

class QProcess;
class QTime;

class FFmpegWrapper : public QObject
{
    Q_OBJECT
public:
    explicit FFmpegWrapper(QObject *parent = 0);
    ~FFmpegWrapper();
    void init(const QString& inputFile);
    QSize fitTo(QSize size);
    bool convert(const QString& outputFile, bool forceH264, bool cut, const QTime& from, const QTime& to);
    const QSize& getFrameSize() { return frameSize; }
    double getDuration() { return duration; }

signals:
    void progressNotification(int seconds);
    void finished(int code);

public slots:
    void readFFmpegStandardError();

private:
    QString inputFile;
    QString outputFile;
    QSize frameSize;
    double duration;
    QProcess* ffmpeg;
    QString output;
};

#endif // FFMPEGWRAPPER_H
